﻿namespace AgileZen.Models
{
    using System.Runtime.Serialization;

    [DataContract(Name = "task")]
    public class Task : AgileZenModel
    {
        private int _id;
        private string _text;
        private string _status;

        [DataMember(Name = "id", Order = 0, EmitDefaultValue = false)]
        public int Id
        {
            get { return _id; }
            set { _id = value; NotifyPropertyChanged("Id"); }
        }
        
        public bool ShouldSerializeId()
        {
            return PropertiesChanged.Contains("Id");
        }

        [DataMember(Name = "text", Order = 1, EmitDefaultValue = false)]
        public string Text
        {
            get { return _text; }
            set { _text = value; NotifyPropertyChanged("Text"); }
        }

        public bool ShouldSerializeText()
        {
            return PropertiesChanged.Contains("Text");
        }

        [DataMember(Name = "status", Order = 2, EmitDefaultValue = false)]
        public string Status
        {
            get { return _status; }
            set { _status = value; NotifyPropertyChanged("Status"); }
        }

        public bool ShouldSerializeStatus()
        {
            return PropertiesChanged.Contains("Status");
        }
    }
}
